package com.shop.agentDataImpl.shopWindow;

import com.shop.agentDataImpl.ShopWindowDataServer;
import com.shop.dto.SelectShopWindowDto;
import com.shop.entity.ShopWindowDo;
import com.shop.mapper.ext.ShopWindowDoMapperExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("clientShopWindowDataImpl")
public class ClientShopWindowDataImpl implements ShopWindowDataServer<SelectShopWindowDto> {

    @Autowired
    private ShopWindowDoMapperExt shopWindowDoMapperExt;

    @Override
    public List<SelectShopWindowDto> getClientShopWindowData(ShopWindowDo shopWindowDo) throws Exception {
        List<SelectShopWindowDto> selectShopWindowDtos = shopWindowDoMapperExt.selectShopWindow(shopWindowDo);
        selectShopWindowDtos.sort(((o1, o2) -> o1.getShopWindowSort().compareTo(o2.getShopWindowSort())));
        return selectShopWindowDtos;
    }
}
